﻿using System;
using System.Collections.Generic;
using System.Linq;

using Fuse8.DomainFramework.Common;

using Fuse8.ContentManagementFramework.Domain;

namespace Fuse8.ContentManagementFramework.Domain.Special
{
    [Serializable]
    public class CmsAdminMediaContent
    {
        #region Fields

        private string _metaCode;

        #endregion

        #region Properties

        public int FileId { get; set; }

        public string Name { get; set; }

        public string Description { get; set; }

        public string MetaCode
        {
            get
            {
                if (string.IsNullOrWhiteSpace(_metaCode))
                {
                    _metaCode = Name
                        .Split(new char[' '], StringSplitOptions.RemoveEmptyEntries)
                        .Aggregate(
                            (working, next) =>
                            {
                                return string.Format("{0}{1}", working, next);
                            });
                }

                return _metaCode;
            }
            set
            {
                _metaCode = value;
            }
        }

        public IList<int> Tags { get; set; }

        public bool BlockFromSearchEngines { get; set; }

        #endregion

        public CmsAdminMediaContent()
        { }
    }
}